package com.design.designmode.action.observe;

/**
 * @author hxl
 * @since 2023-04-18
 */
public class Main {
    public static void main(String[] args) {
        Subject subjectA = new ConcreteSubject("目标A");

        Observer observerB = new ConcreteObserver("张三", subjectA);
        Observer observerC = new ConcreteObserver("李四", subjectA);
        Observer observerD = new ConcreteObserver("王五", subjectA);

        subjectA.setState("更新了");

        System.out.println("======================================");

        subjectA.detach(observerD);

        subjectA.setState("停更了");

    }
}
